###Pearson's Data and Bivariate Boxplots ###Reading in Pearson's data from a file in .csv format. Heights<-read.csv("Pearson's Height Data.csv") #Calculating the univariate boxplots. boxplot(Heights$Father) boxplot(Heights$Son, pch=19) ###Activating the MVA library library("MVA") ###Constructing the bivariate boxplot. See comments below. with(Heights,bvbox(cbind(Father, Son),7, pch=20, xlab="Heights of Fathers",ylab="Heights of Sons")) #The function, "with()", tells R the data structure in which it can find #the data referenced in the subsequent function call. #This makes it easier to compose and make sense of the subsequent function call. #The second argument for the "bvbox" function (7 in this case) specifies #how much larger the "fence" ellipse should be vs. the "hinge" ellipse. #With a value of 7, this will tend to create a fence that contains about 99% #of a dataset that has been generated by a bivariate normal distribution. #The argument, "pch=20" specifies that the character to be used to represent #points is a small circle. You can find other options in the R documentation. #The final two arguments just specify axis labels. Note, however, that the #y-axis label will likely be hidden. This glitch in the bvbox function #needs to be fixed. ###Some script for creating three-dimensional scatterplots. library("scatterplot3d") scatterplot3d(MLB$Earned.Run.Avg,MLB$Errors,MLB$Pct.Wins,type="h")